package jk.framework.canary.core.rule;

import jk.framework.canary.core.po.RouteContext;
import org.apache.commons.lang.ObjectUtils;

/**
 * 主条件相等规则
 * @author cuichao
 */
public class ConditionEqualsRule implements RouteRule<Object> {

    private String equalsValue;

    @Override
    public boolean isAllow(RouteContext<Object> context) {
        return  ObjectUtils.equals(context.getCondition(),equalsValue) ;
    }


    public ConditionEqualsRule() {

    }

    public ConditionEqualsRule(String equalsValue) {
        this.equalsValue = equalsValue;
    }

    public ConditionEqualsRule setEqualsValue(String equalsValue) {
        this.equalsValue = equalsValue;
        return this;
    }

    public String getEqualsValue() {
        return equalsValue;
    }
}
